<?php
header("Content-type: text/html; charset=utf-8");
ini_set('display_errors', 1);
set_time_limit(0);
include_once dirname(dirname(__FILE__)) . '/mgtv_v2/mgtv_init.php';
$db = nn_get_db(NL_DB_WRITE);




$bool = true;
$i=0;
while($bool){
    $sql="select * from nns_mgtvbk_c2_task where nns_org_id='sihua' and nns_type='index' order by nns_create_time desc   limit $i,1";
    $info = nl_db_get_one($sql, $db);
    if(empty($info)||$info==null){
        $bool=false;
        break;
    }
    $id = $info['nns_id'];
    $info['nns_id'] = np_guid_rand('shanghai_mobile'.$id);
    $info['nns_org_id'] = 'shanghai_mobile';
    //if($info['nns_status']==0 || $info['nns_epg_status']==99){
        $info['nns_epg_status'] = 97;
        $info['nns_status'] = 1;
    //}
    //$info['nns_op_id']='';
    
    
    
    $re = nl_db_insert($db, 'nns_mgtvbk_c2_task', $info);
    
    usleep(1);
    
    if(!$re){
        echo $info['nns_name'].PHP_EOL;
    }
    unset($info,$sql);
    $i++;
}